﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Quản_Lý_Thư_Viện
{
    public partial class frmDoiMatKhau : Form
    {
        public frmDoiMatKhau()
        {
            InitializeComponent();
        }
        PhanquyenControl control = new PhanquyenControl();
        PhanquyenInfo info = new PhanquyenInfo();

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtMatKhauCu.Text == "")
            {
                MessageBox.Show("Nhập Mật Khẩu Cũ Vào Trước !");
                txtMatKhauCu.Focus();
            }
            else
            {
                info.Matkhau = txtMatKhauMoi.Text;
                control.updatematkhau(info);
                MessageBox.Show("Đổi Mật Khẩu Thành Công ");
            }
        }
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == (Keys.Escape))
            {
                this.Close();
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }

        private void btnHuy_Click(object sender, EventArgs e)
        {
            this.Close();
        }      

    }
}
